<?php

class Helper_String
{
	static public function randomString($len = 8, $type = 1)
	{
		if($type ==1){
			$string = '1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm';
		}else{
			$string = 'QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm';
		}
		$max = strlen($string) - 1;
		$ret = '';
		for ($i = 0; $i < $len; ++$i)
		{
			$ret .= substr($string, mt_rand(0, $max), 1);
		}
		return $ret;
	}

	/**
	 * create password hash
	 * @param multiple string
	 * @return 38 bytes password string
	 */
	static public function createPassword(/*anonimate function*/)
	{
		return sha1(implode(';', func_get_args()), false);
	}

}
